package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.INewTaskExecutionDAO;
import org.jsbd.boss.domian.channel.NewTaskExecutionDTO;
import org.jsbd.boss.domian.channel.NewTaskExecutionVO;
import org.springframework.stereotype.Repository;

import edu.hziee.common.dbroute.BaseDAO;

@Repository("newTaskExecutionDAO")
public class NewTaskExecutionDAOImpl extends BaseDAO implements INewTaskExecutionDAO {

	@Override
	public Map<String, Object> findNewTaskExecutionWithPage(DataGridModel page, NewTaskExecutionVO nteVO) {
		nteVO = (nteVO == null ? new NewTaskExecutionVO() : nteVO);
		nteVO.setPageInfo(page);
	    Map<String, Object> results = new HashMap<String, Object>();
	    results.put("rows", super.queryForList("qy_new_task_execution_login_type.SELECT_LIST_WITH_CONDITION", nteVO));
	    results.put("total", super.queryForList("qy_new_task_execution_login_type.SELECT_COUNT_WITH_CONDITION", nteVO));
	    return results;
	}

	@Override
	public List<NewTaskExecutionDTO> findByMarkAndDay(String mark, String day) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("mark", mark);
		map.put("day", day);
		return super.queryForList("qy_new_task_execution_login_type.FIND_BY_MARK_AND_DAY", map);
	}

	@Override
	public Map<String, Object> findNewTaskExecutionMarkWithPage(DataGridModel page, NewTaskExecutionVO nteVO) {
		nteVO = (nteVO == null ? new NewTaskExecutionVO() : nteVO);
		nteVO.setPageInfo(page);
	    Map<String, Object> results = new HashMap<String, Object>();
	    results.put("rows", super.queryForList("qy_new_task_execution_login_type.SELECT_MARK_LIST_WITH_CONDITION", nteVO));
	    results.put("total", super.queryForList("qy_new_task_execution_login_type.SELECT_MARK_COUNT_WITH_CONDITION", nteVO));
	    return results;
	}

	@Override
	public List<NewTaskExecutionDTO> findByLoginTypeAndDay(String loginType, String day) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("loginType", loginType);
		map.put("day", day);
		return super.queryForList("qy_new_task_execution_login_type.FIND_BY_LOGIN_TYPE_AND_DAY", map);
	}

}
